<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
    <title>Create Person</title>
  </head>

  <body>
    <div class="nav">
      <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>
      <span class="menuButton"><g:link class="list" action="list">Person List</g:link></span>
    </div>

    <div class="body">
      <h1>Create Person</h1>

      <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
      </g:if>

      <g:hasErrors bean="${personInstance}">
        <div class="errors">
          <g:renderErrors bean="${personInstance}" as="list" />
        </div>
      </g:hasErrors>

      <g:form action="save" method="post" enctype="multipart/form-data">
        <div class="dialog">
          <table>
            <tbody>              
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="name">Name:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'name','errors')}">
                  <input type="text" id="name" name="name" value="${fieldValue(bean:personInstance, field:'name')}" />
                </td>
              </tr> 
              
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="lastName">Last Name:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'lastName','errors')}">
                  <input type="text" id="lastName" name="lastName" value="${fieldValue(bean:personInstance, field:'lastName')}" />
                </td>
              </tr> 
              
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="telephone">Telephone:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'telephone','errors')}">
                  <input type="text" id="telephone" name="telephone" value="${fieldValue(bean:personInstance,field:'telephone')}"/>
                </td>
              </tr> 
              
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="email">Email:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'email','errors')}">
                  <input type="text" id="email" name="email" value="${fieldValue(bean:personInstance,field:'email')}"/>
                </td>
              </tr> 

              <tr class="prop">
                <td valign="top" class="name">
                  <label for="cv">CV:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:personInstance,field:'cvFilepath','errors')}">
                  <input type="file" id="cvFilepath" name="cv" value="${fieldValue(bean:personInstance,field:'cvFilepath')}"/>
                </td>
              </tr>
            </tbody>
          </table>

	  <a href="#" class="show-nonrequired-link">Show others properties</a>
	  <a href="#" class="hide-nonrequired-link">Hide others properties</a>

	  <div class="nonrequired-field"> 
	    <table>
	      <tbody>
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="birthday">Birthday:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'birthday','errors')}">
		    <input class="datepicker-field" id="birthday-datepicker" type="text" name="birthday" value="${personInstance?.birthday}"/>
                  </td>
		</tr> 
		
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="personalIdNumber">Personal Id Number:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'personalIdNumber','errors')}">
                    <input type="text" id="personalIdNumber" name="personalIdNumber" value="${fieldValue(bean:personInstance,field:'personalIdNumber')}"/>
                  </td>
		</tr> 
		
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="nip">Nip:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'nip','errors')}">
                    <input type="text" id="nip" name="nip" value="${fieldValue(bean:personInstance,field:'nip')}"/>
                  </td>
		</tr> 
		
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="accountNumber">Account Number:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'accountNumber','errors')}">
                    <input type="text" id="accountNumber" name="accountNumber" value="${fieldValue(bean:personInstance,field:'accountNumber')}"/>
                  </td>
		</tr> 
                
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="country">Country:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'country','errors')}">
                    <input type="text" id="country" name="country" value="${fieldValue(bean:personInstance,field:'country')}"/>
                  </td>
		</tr> 
		
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="city">City:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'city','errors')}">
                    <input type="text" id="city" name="city" value="${fieldValue(bean:personInstance,field:'city')}"/>
                  </td>
		</tr> 
		
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="streetNumber">Street Number:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'streetNumber','errors')}">
                    <input type="text" id="streetNumber" name="streetNumber" value="${fieldValue(bean:personInstance,field:'streetNumber')}"/>
                  </td>
		</tr> 
		
		<tr class="prop">
                  <td valign="top" class="name">
                    <label for="postalCode">Postal Code:</label>
                  </td>
                  <td valign="top" class="value ${hasErrors(bean:personInstance,field:'postalCode','errors')}">
                    <input type="text" id="postalCode" name="postalCode" value="${fieldValue(bean:personInstance,field:'postalCode')}"/>
                  </td>
		</tr>
	      </tbody>
	    </table>
	  </div>
        </div>

        <div class="buttons">
          <span class="button"><input class="save" type="submit" value="Create" /></span>
        </div>
      </g:form>
    </div>
  </body>
</html>
